//#include <linux/device.h> 
/* This is a #define to keep the compiler from merging different
 * instances of the __key variable */
#define class_register(class)      \
({            \
  static struct lock_class_key __key;  \
  __class_register(class, &__key);  \
})


/*

struct class *mem_class;
...

static void class_create_release(struct class *cls)
{
    kfree(cls);
}
...
mem_class = kzalloc(sizeof(*mem_class), GFP_KERNEL);

if(mem_class == NULL)
{
    printk("create mem class failed!\n");
    return -1;
}

mem_class->name = CLASS_NAME;
mem_class->owner = THIS_MODULE;

mem_claas->class_release = class_create_release;
int rvl = class_register(mem_class);
if(rvl)
{
    printk("class register failed!\n");
    kfree(mem_class);
    return -1;
}


*/